# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit eutils toolchain-funcs autotools

DESCRIPTION="Kino utilities for video fx, fullscreen DV playback"
HOMEPAGE="http://www.kinodv.org/article/view/70/1/7"
SRC_URI="http://www.kinodv.org/filemanager/download/14/${P}.tar.gz"

RESTRICT="primaryuri"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~amd64"

IUSE="ffmpeg imlib lame vorbis"
RDEPEND="
	gnome-base/libglade
	>=x11-libs/gtk+-2.6
	x11-libs/pango
	x11-libs/cairo
	dev-libs/libxml2
	>=media-libs/libdv-0.102
	media-libs/libsamplerate
	media-libs/alsa-lib
	x11-libs/libXv
	dev-libs/libpthread-stubs
	media-video/ffmpeg
	sys-libs/libraw1394
	media-libs/libiec61883
	sys-libs/libavc1394
"
DEPEND="${RDEPEND}"

src_unpack() {
	unpack ${A}
	cd "${S}"
	epatch "${FILESDIR}/${P}-qt-gdk-cairo-pango.patch"
	epatch "${FILESDIR}/${P}-fix-all-warnings.patch"
	eautomake
}

src_compile() {
	local myconf
	CXXFLAGS="${CXXFLAGS} -fpermissive"
	econf \
		--disable-dependency-tracking \
		--disable-debug \
		${myconf} || die "configure failed"
	emake || die "make failed"
}

src_install() {
	einstall || die "Install failed"
	mv ${D}/usr/bin/rawplay ${D}/usr/bin/dvplay
	cat ${D}/usr/share/man/man1/rawplay.1 \
        | sed -e 's/rawplay/dvplay/g' -e 's/RAWPLAY/DVPLAY/g' \
	> ${D}/usr/share/man/man1/dvplay.1
	rm -f ${D}/usr/share/man/man1/rawplay.1
	
	ewarn "Note that to avoid a clash with media-sound/rawrec"
	ewarn "'rawplay' has been renamed 'dvplay'."
}

